<?php
class Back_Form_Competitions extends Jnd_Form
{
    protected $_parents = array();

    public function __construct( $decorateur = "Formulairejndpro", $options = null )
    {
        if (isset($options["parents"])) {
            $this->_parents = $options['parents'];
        }
        parent::__construct($decorateur, $options);
        $this->setElementDecorators(array(
            "$decorateur"
        ), array(), false);
    }

    public function init()
    {
        $this->setAction('/back/competitions/editer');
        $this->setName("competition");
        $this->setMethod("post");
        $this->addAttribs(array(
            "class" => "cssform"
        ));
        
        $champ = new Zend_Form_Element_Hidden("id");
        $champs[] = $champ;
        
        $champ = new Zend_Form_Element_Text("nom");
        $champ->setLabel(__("Nom"));
        $champ->setRequired(true);
        $champs[] = $champ;
        
        $champ = new Zend_Form_Element_Select("enfantDe");
        $champ->setLabel(__("Enfant de"));
        $champ->setRequired(true);
        $champ->setMultiOptions($this->_parents);
        $champs[] = $champ;
        
        $champ = new Jnd_Form_Element_HiddenDisplay("niveau");
        $champ->setLabel(__("Niveau dans l'arbre"));
        $champs[] = $champ;
        
        $champ = new Zend_Form_Element_Textarea("url");
        $champ->setLabel(__("Lien de la page"));
        $champ->setDescription(__("Indiquer l'url de la page qui a été crée par l'administration, laisser vide si le lien ne doit rien ouvrir"));
        $champs[] = $champ;
        
        $this->addElements($champs);
    }
}

